/* Export Dialog Styles */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.dialog {
  background: var(--color-surface, #ffffff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: dialogSlideIn 0.3s ease-out;
  border: 1px solid var(--color-border-primary, #e5e7eb);
}

@keyframes dialogSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px 24px;
  border-bottom: 1px solid var(--color-border-secondary, #f3f4f6);
}

.title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary, #1f2937);
}

.closeButton {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--color-text-secondary, #6b7280);
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.closeButton:hover {
  background: var(--color-hover, rgba(0, 0, 0, 0.05));
  color: var(--color-text-primary, #1f2937);
}

.content {
  flex: 1;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.fileInfo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-surface-variant, #f9fafb);
  border-radius: 8px;
  border: 1px solid var(--color-border-secondary, #f3f4f6);
}

.fileName {
  font-family: var(--font-family-mono, 'Monaco', 'Menlo', monospace);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #1f2937);
}

.fileSize {
  font-size: 12px;
  color: var(--color-text-secondary, #6b7280);
}

.codeContainer {
  flex: 1;
  border: 2px solid var(--color-border-secondary, #f3f4f6);
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface-variant, #f9fafb);
  min-height: 200px;
  max-height: 300px;
}

.codeTextarea {
  width: 100%;
  height: 100%;
  min-height: 200px;
  padding: 16px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text-primary, #1f2937);
  font-family: var(--font-family-mono, 'Monaco', 'Menlo', monospace);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.codeTextarea::placeholder {
  color: var(--color-text-secondary, #6b7280);
  font-style: italic;
}

.codeTextarea:focus {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.statusMessage {
  padding: 12px 16px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px 20px 24px;
  border-top: 1px solid var(--color-border-secondary, #f3f4f6);
}

.actionButton {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 2px solid var(--color-border-primary, #e5e7eb);
  border-radius: 10px;
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #1f2937);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
}

.actionButton:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-1px);
}

.actionButton:active {
  transform: translateY(0);
}

.copyButton:hover {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
  color: #22c55e;
}

.downloadButton:hover {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.05);
  color: #8b5cf6;
}

.tips {
  padding: 0 24px 20px 24px;
}

.tipText {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-secondary, #6b7280);
  line-height: 1.4;
  text-align: center;
  padding: 12px 16px;
  background: var(--color-surface-variant, #f9fafb);
  border-radius: 8px;
  border-left: 3px solid #3b82f6;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .overlay {
    padding: 10px;
    align-items: center;
    justify-content: center;
    /* 当内容过长时允许滚动 */
    overflow-y: auto;
  }

  .dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 40px);
    margin: auto;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    /* 确保在小屏幕上也能居中 */
    min-height: fit-content;
  }

  .header {
    padding: 16px 20px 12px 20px;
    position: sticky;
    top: 0;
    background: var(--color-surface, #ffffff);
    z-index: 1;
    border-radius: 12px 12px 0 0;
  }

  .title {
    font-size: 16px;
  }

  .closeButton {
    padding: 10px;
    margin: -2px;
  }

  .content {
    padding: 12px 20px;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fileInfo {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .actions {
    flex-direction: column;
    padding: 12px 20px 16px 20px;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--color-surface, #ffffff);
    border-radius: 0 0 12px 12px;
  }

  .actionButton {
    padding: 16px;
    font-size: 15px;
    border-radius: 12px;
    min-height: 48px;
    touch-action: manipulation;
  }

  .tips {
    padding: 0 20px 16px 20px;
  }

  .tipText {
    font-size: 11px;
    padding: 10px 12px;
  }

  .codeContainer {
    min-height: 180px;
    max-height: 250px;
    border-radius: 10px;
  }

  .codeTextarea {
    min-height: 180px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.4;
  }
}

/* 小屏幕移动设备（iPhone SE等） */
@media (max-width: 480px) {
  .overlay {
    padding: 5px;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
  }

  .dialog {
    max-height: calc(100vh - 20px);
    border-radius: 10px;
    margin: auto;
    min-height: fit-content;
  }

  .header {
    padding: 14px 16px 10px 16px;
    border-radius: 10px 10px 0 0;
  }

  .title {
    font-size: 15px;
  }

  .content {
    padding: 10px 16px;
    gap: 10px;
  }

  .actions {
    padding: 10px 16px 14px 16px;
    gap: 8px;
    border-radius: 0 0 10px 10px;
  }

  .actionButton {
    padding: 14px;
    font-size: 14px;
    min-height: 44px;
  }

  .tips {
    padding: 0 16px 14px 16px;
  }

  .codeContainer {
    min-height: 160px;
    max-height: 200px;
  }

  .codeTextarea {
    min-height: 160px;
    padding: 12px;
    font-size: 12px;
  }
}

/* 暗色主题适配 */
[data-theme="dark"] .overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .dialog {
  background: var(--color-surface);
  border-color: var(--color-border-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .header {
  background: var(--color-surface);
  border-bottom-color: var(--color-border-secondary);
}

[data-theme="dark"] .title {
  color: var(--color-text-primary);
}

[data-theme="dark"] .closeButton {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .closeButton:hover {
  background: var(--color-hover);
  color: var(--color-text-primary);
}

[data-theme="dark"] .fileInfo {
  background: var(--color-surface-variant);
  border-color: var(--color-border-secondary);
}

[data-theme="dark"] .fileName {
  color: var(--color-text-primary);
}

[data-theme="dark"] .fileSize {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .codeContainer {
  background: var(--color-surface-variant);
  border-color: var(--color-border-secondary);
}

[data-theme="dark"] .codeTextarea {
  background: rgba(0, 0, 0, 0.3);
  color: var(--color-text-primary);
}

[data-theme="dark"] .codeTextarea::placeholder {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .actions {
  background: var(--color-surface);
  border-top-color: var(--color-border-secondary);
}

[data-theme="dark"] .actionButton {
  background: var(--color-surface-variant);
  border-color: var(--color-border-primary);
  color: var(--color-text-primary);
}

[data-theme="dark"] .actionButton:hover {
  background: var(--color-hover);
}

[data-theme="dark"] .copyButton:hover {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

[data-theme="dark"] .downloadButton:hover {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

[data-theme="dark"] .statusMessage {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

[data-theme="dark"] .tipText {
  color: var(--color-text-secondary);
  background: var(--color-surface-variant);
}

[data-theme="dark"] .codeTextarea::-webkit-scrollbar-track {
  background: transparent;
}

[data-theme="dark"] .codeTextarea::-webkit-scrollbar-thumb {
  background: var(--color-border-primary);
}

[data-theme="dark"] .codeTextarea::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

/* 滚动条样式 */
.codeTextarea::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.codeTextarea::-webkit-scrollbar-track {
  background: transparent;
}

.codeTextarea::-webkit-scrollbar-thumb {
  background: var(--color-border-primary, #e5e7eb);
  border-radius: 4px;
}

.codeTextarea::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary, #6b7280);
}

/* 项目标签样式 */
.projectTags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.projectTag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--color-primary, #007bff);
  color: white;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}

.fileCountTag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--color-bg-secondary, #f8f9fa);
  color: var(--color-text-secondary, #6c757d);
  border: 1px solid var(--color-border-secondary, #e9ecef);
  border-radius: 16px;
  font-size: 13px;
}

.sizeTag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--color-success-bg, #d1edff);
  color: var(--color-success, #0c5460);
  border: 1px solid var(--color-success-border, #bee5eb);
  border-radius: 16px;
  font-size: 13px;
}

/* 文件列表样式 */
.fileList {
  margin-bottom: 20px;
  border: 1px solid var(--color-border-secondary, #e9ecef);
  border-radius: 8px;
  overflow: hidden;
}

.fileListHeader {
  padding: 12px 16px;
  background: var(--color-bg-tertiary, #f1f3f4);
  border-bottom: 1px solid var(--color-border-secondary, #e9ecef);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary, #6c757d);
}

.fileListContent {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  /* 确保滚动条可见 */
  -webkit-overflow-scrolling: touch;
  /* 强制显示滚动条 */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-primary, #e5e7eb) transparent;
}

/* 滚动条样式 */
.fileListContent::-webkit-scrollbar {
  width: 8px;
}

.fileListContent::-webkit-scrollbar-track {
  background: transparent;
}

.fileListContent::-webkit-scrollbar-thumb {
  background: var(--color-border-primary, #e5e7eb);
  border-radius: 4px;
}

.fileListContent::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary, #6c757d);
}

.fileListItem {
  display: flex;
  align-items: center;
  padding: 12px 16px 12px 16px; /* 使用四个值，让paddingLeft可以被内联样式覆盖 */
  border-bottom: 1px solid var(--color-border-light, #f8f9fa);
  transition: background-color 0.2s ease;
  position: relative;
}

.fileListItem:last-child {
  border-bottom: none;
}

.fileListItem:hover {
  background: var(--color-bg-hover, #f8f9fa);
}

.fileIcon {
  margin-right: 12px;
  font-size: 16px;
  color: var(--color-text-secondary, #6c757d);
  min-width: 16px;
}

.fileName {
  flex: 1;
  font-size: 14px;
  color: var(--color-text-primary, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.fileSize {
  font-size: 12px;
  color: var(--color-text-tertiary, #adb5bd);
  margin-right: 8px;
  white-space: nowrap;
}

/* 文件夹样式 */
.folderItem {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 16px; /* 使用四个值，让paddingLeft可以被内联样式覆盖 */
  border-bottom: 1px solid var(--color-border-light, #f8f9fa);
  transition: background-color 0.2s ease;
  font-weight: 500;
  color: var(--color-text-primary, #212529);
}

.folderItem:hover {
  background: var(--color-bg-hover, #f8f9fa);
}

.folderIcon {
  margin-right: 12px;
  font-size: 16px;
  color: var(--color-warning, #ffc107);
  min-width: 16px;
}

.folderName {
  flex: 1;
  font-size: 14px;
  color: var(--color-text-primary, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emptyFileList {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--color-text-tertiary, #adb5bd);
}

.emptyIcon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.6;
}

/* 层级指示器样式 */
.levelIndicator {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.levelLine {
  width: 1px;
  height: 100%;
  background: var(--color-border-secondary, #e9ecef);
  margin-right: 19px;
  position: relative;
}

.levelLine::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -19px;
  width: 19px;
  height: 1px;
  background: var(--color-border-secondary, #e9ecef);
  transform: translateY(-50%);
}

/* 输入组样式 */
.inputGroup {
  margin-bottom: 20px;
}

.inputLabel {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary, #212529);
}

.inputIcon {
  margin-right: 8px;
  font-size: 14px;
  color: var(--color-text-secondary, #6c757d);
}

.textInput {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #212529);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textInput:focus {
  outline: none;
  border-color: var(--color-primary, #007bff);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.textInput::placeholder {
  color: var(--color-text-tertiary, #adb5bd);
}

/* 按钮样式增强 */
.cancelButton {
  background: var(--color-bg-secondary, #f8f9fa);
  color: var(--color-text-secondary, #6c757d);
  border: 1px solid var(--color-border-primary, #e5e7eb);
}

.cancelButton:hover {
  background: var(--color-bg-hover, #e9ecef);
  border-color: var(--color-border-hover, #dee2e6);
}

.confirmButton {
  background: var(--color-primary, #007bff);
  color: white;
  border: 1px solid var(--color-primary, #007bff);
}

.confirmButton:hover {
  background: var(--color-primary-hover, #0056b3);
  border-color: var(--color-primary-hover, #0056b3);
}

.confirmButton:disabled {
  background: var(--color-bg-disabled, #e9ecef);
  color: var(--color-text-disabled, #adb5bd);
  border-color: var(--color-border-disabled, #e9ecef);
  cursor: not-allowed;
}

/* 文件操作区样式 */
.fileActions {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
}

.fileListItem:hover .fileActions {
  opacity: 1 !important;
}

.fileActions .actionButton {
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--color-text-secondary, #6c757d);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fileActions .actionButton:hover {
  background: var(--color-bg-hover, #f8f9fa);
  color: var(--color-text-primary, #212529);
}

/* 上下文菜单样式 */
.contextMenu {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  min-width: 160px;
  overflow: hidden;
}

.contextMenuContent {
  padding: 4px 0;
}

.contextMenuItem {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 14px;
  color: var(--color-text-primary, #212529);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.contextMenuItem:hover {
  background: var(--color-bg-hover, #f8f9fa);
}

.contextMenuItem.dangerItem {
  color: var(--color-danger, #dc3545);
}

.contextMenuItem.dangerItem:hover {
  background: var(--color-danger-bg, #f8d7da);
  color: var(--color-danger, #dc3545);
}

.contextMenuIcon {
  margin-right: 8px;
  font-size: 14px;
  min-width: 14px;
}

.contextMenuDivider {
  height: 1px;
  background: var(--color-border-secondary, #e9ecef);
  margin: 4px 0;
}

/* 小弹窗样式 */
.smallDialog {
  background: var(--color-surface, #ffffff);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  animation: dialogSlideIn 0.3s ease-out;
  border: 1px solid var(--color-border-primary, #e5e7eb);
}

/* 警告消息样式 */
.warningMessage {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--color-warning-bg, #fff3cd);
  border: 1px solid var(--color-warning-border, #ffeaa7);
  border-radius: 8px;
  color: var(--color-warning-text, #856404);
}

.warningIcon {
  font-size: 20px;
  color: var(--color-warning, #ffc107);
  margin-top: 2px;
  min-width: 20px;
}

.warningText {
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.8;
}

/* 危险按钮样式 */
.dangerButton {
  background: var(--color-danger, #dc3545);
  color: white;
  border: 1px solid var(--color-danger, #dc3545);
}

.dangerButton:hover {
  background: var(--color-danger-hover, #c82333);
  border-color: var(--color-danger-hover, #c82333);
}

/* 暗色主题适配 */
[data-theme="dark"] .contextMenu {
  background: var(--color-surface-variant);
  border-color: var(--color-border-primary);
}

[data-theme="dark"] .contextMenuItem {
  color: var(--color-text-primary);
}

[data-theme="dark"] .contextMenuItem:hover {
  background: var(--color-hover);
}

[data-theme="dark"] .contextMenuItem.dangerItem {
  color: #ff6b6b;
}

[data-theme="dark"] .contextMenuItem.dangerItem:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
}

[data-theme="dark"] .contextMenuDivider {
  background: var(--color-border-primary);
}

[data-theme="dark"] .smallDialog {
  background: var(--color-surface-variant);
  border-color: var(--color-border-primary);
}

[data-theme="dark"] .warningMessage {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

[data-theme="dark"] .warningIcon {
  color: #ffc107;
}

/* 暗色主题标签适配 */
[data-theme="dark"] .fileCountTag {
  background: var(--color-surface-variant);
  color: var(--color-text-secondary);
  border-color: var(--color-border-primary);
}

[data-theme="dark"] .sizeTag {
  background: rgba(13, 202, 240, 0.1);
  color: #0dcaf0;
  border-color: rgba(13, 202, 240, 0.3);
}

[data-theme="dark"] .folderIcon {
  color: #ffc107;
}

[data-theme="dark"] .folderItem {
  color: var(--color-text-primary);
}

[data-theme="dark"] .folderItem:hover {
  background: var(--color-hover);
}

[data-theme="dark"] .folderName {
  color: var(--color-text-primary);
}
